home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2000 #5
/
Amiga Plus CD - 2000 - No. 5.iso
/
Tools
/
Misc
/
InstallerNG
/
developer
/
gui
/
example
/
igui_AskString.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-10-31
|
3KB
|
103 lines
#include "includes.h"
#include "installergui_data.h"
#include <string.h>
/********************************************************************
*
* DESCRIPTION
*
* ask the user for a string. i.e. simply create a string gadget,
* set its content to the default string (if any) and return
* the content (a copy of the content, since disposing the gadget
* will dispose the content too!)
*
* IN: application - pointer to the private application structure
* localenv - the local environment of the related ASKSTRING function
*
* OUT: the string, typed in by the user
*
*/
/********************************************************************
*
* STATIC
*
*/
/********************************************************************
*
* EXTERN
*
*/
/********************************************************************
*
* PUBLIC
*
*/
/********************************************************************
*
* CODE
*
*/
char * __asm igui_AskString(register __a0 APTR application,
register __a1 struct FunctionEnvironment *localenv)
{
#ifdef DEBUG
DEBUG_MAKRO
#endif
{
struct Application *app = (struct Application *) application;
APTR str, txt = NULL;
APTR strobj,
obj = GroupObject,
Child, HVSpace,
Child, TextObject,
MUIA_Frame, MUIV_Frame_None, //MUIV_Frame_Text,
MUIA_Text_Contents, localenv->fe_Prompt,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, strobj = StringObject,
MUIA_Frame, MUIV_Frame_String,
MUIA_String_Contents, localenv->fe_Default,
MUIA_String_Format, MUIV_String_Format_Center,
End,
Child, HVSpace,
End;
// maybee BACK (if specified) or respect the swing mode
if (localenv->fe_Back) { guistuff_SetBackButton(app, TRUE); }
else if (!app->app_SWING_Mode) { igui_NameCancel(app, (char *) app->app_GlobalEnv[GENV_ABORT_BUTTON]); }
//
if (guistuff_NewContent(app, obj))
{
//
igui_WaitApp(app);
if (!igui_QuitApp(app))
{
//
GetAttr(MUIA_String_Contents, strobj, (ULONG *) &str);
txt = sav_AllocVec(strlen(str) + 1, MEMF_ANY);
if (txt) { strcpy(txt, str); }
else { /* NO MEMORY */ }
}
igui_EmptyPanel(app);
}
else { /* NO GUI OBJECT */ }
if (localenv->fe_Back) { guistuff_SetBackButton(app, FALSE); }
return(txt);
}
}